import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import websocket from '@/websocket/login'
import App from './App.vue'
import router from './router'
import {useEquipmentInfoStore} from '@/stores/equipment-info-store'
const app = createApp(App)
const pinia = createPinia();
app.use(createPinia())
app.use(router)
app.use(pinia);
app.mount('#app')
const store = useEquipmentInfoStore()
const { closeWebsocket } = websocket()
router.beforeEach((to) => {
  if (to.path === '/login') {
    closeWebsocket()
  }
  store.setCurrentId(to.query?.id as string)
})
